package service.impl;

import models.Collection;
import models.CollectionGroup;
import service.CollectionInterface;

import java.util.List;

public class CollectionImpl implements CollectionInterface {
    @Override
    public void createCollectionGroup(CollectionGroup group) {
        group.save();
    }

    @Override
    public List<Collection> getCollectionListByPage(Integer userId, Integer groupId) {
        return Collection.find("userId=? and groupId=?", userId, groupId).fetch();
    }

    @Override
    public List<CollectionGroup> getCollectionGroupListByPage(Integer userId) {
        return CollectionGroup.find("userId=?", userId).fetch();
    }

    @Override
    public void collection(Collection collection) {
        collection.save();
    }
}
